package com.gitee.mars.vaccin.controller;

import com.gitee.mars.vaccin.request.SysUserLoginRequest;
import com.gitee.mars.vaccin.request.SysUserRequest;
import com.gitee.mars.vaccin.response.result.R;
import com.gitee.mars.vaccin.service.ISysUserService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * SysUser 控制层
 *
 * @Author wq
 * @Date 2021-03-15
 **/
@RestController
@RequestMapping("/sysUser")
@AllArgsConstructor
public class SysUserController {

    private final ISysUserService sysUserService;


    /**
     * 登录
     *
     * @param request request
     * @return R
     */
    @PostMapping("/login")
    public R login(@RequestBody SysUserLoginRequest request) {
        return R.success(sysUserService.login(request));
    }

    /**
     * 用户列表
     *
     * @param request request
     * @return R
     */
    @PostMapping("/list")
    public R list(@RequestBody SysUserRequest request) {
        return R.success(sysUserService.listUser(request));
    }

}